/**
 * 优先队列
 *
 * @author Kevin
 * @date 2018-12-20
 */
public class PriorityQueue<E extends Comparable<E>> implements Queue<E> {

    /**
     * 最大堆
     */
    private MaxHeap<E> maxHeap;

    public PriorityQueue() {
        this.maxHeap = new MaxHeap<>();
    }

    @Override
    public int getSize() {
        return this.maxHeap.size();
    }

    @Override
    public boolean isEmpty() {
        return this.maxHeap.isEmpty();
    }

    @Override
    public void enqueue(E e) {
        this.maxHeap.add(e);
    }

    @Override
    public E dequeue() {
        return this.maxHeap.extractMax();
    }

    @Override
    public E getFront() {
        return this.maxHeap.findMax();
    }

}
